using System.Collections.Generic;

namespace OffsetPath
{
    public class ClassD : PolygonalShape
    {
        public ClassD()
        {
            base.ExternProfile = new ClassAl();
        }

        public ClassD(PolygonalShape A_0)
        {
            base.ExternProfile = new ClassAl(A_0.GetExternPolygon());
            for (int i = 0; i < A_0.holesCount(); i++)
            {
                base.PolygonHoles.Add(new ClassAl(A_0.GetHolesProfileAt(i)));
            }
        }

        public ClassD(ClassAl A_0)
        {
            base.ExternProfile = new ClassAl(A_0);
        }

        public ClassD(ClassD A_0)
        {
            base.ExternProfile = new ClassAl(A_0.MethodA());
            for (int i = 0; i < A_0.holesCount(); i++)
            {
                base.PolygonHoles.Add(new ClassAl(A_0.MethodB(i)));
            }
        }

        public ClassD(OffsetProfilo2D A_0)
        {
            base.ExternProfile = new ClassAl(A_0);
        }

        public ClassAl MethodA()
        {
            return (base.ExternProfile as ClassAl);
        }

        public void MethodA(PolygonalShape A_0)
        {
            base.ExternProfile.MethodA(A_0.GetExternPolygon());
            base.PolygonHoles.Clear();
            for (int i = 0; i < A_0.holesCount(); i++)
            {
                base.PolygonHoles.Add(new ClassAl(A_0.GetHolesProfileAt(i)));
            }
        }

        public void MethodA(ClassAl A_0)
        {
            base.ExternProfile = A_0;
        }

        public void MethodA(ClassD A_0)
        {
            base.ExternProfile.MethodA(A_0.MethodA());
            base.PolygonHoles.Clear();
            for (int i = 0; i < A_0.holesCount(); i++)
            {
                base.PolygonHoles.Add(new ClassAl(A_0.MethodB(i)));
            }
        }

        public void MethodA(OffsetProfilo2D A_0)
        {
            if (A_0 is ClassAl)
            {
                base.PolygonHoles.Add(A_0);
            }
        }

        public void MethodA(int A_0)
        {
            base.PolygonHoles.RemoveAt(A_0);
        }

        public void MethodA(int A_0, ClassAl A_1)
        {
            base.PolygonHoles[A_0] = A_1;
        }

        public void MethodA(int A_0, OffsetProfilo2D A_1)
        {
            if (A_1 is ClassAl)
            {
                base.PolygonHoles[A_0] = A_1;
            }
        }

        public void MethodA(ClassD A_0, List<ClassD> A_1, ClassAg A_2)
        {
            List<PolygonalShape> list = new List<PolygonalShape>();
            base.MethodA1(A_0, list, A_2);
            for (int i = 0; i < list.Count; i++)
            {
                A_1.Add(new ClassD(list[i]));
            }
        }

        private PuntoDueD MethodB()
        {
            var x = this.MethodA().c();
            double num = this.MethodA().d();
            for (int i = 0; i < base.PolygonHoles.Count; i++)
            {
                var at = new ClassAtPuntoIncrementale(x, this.MethodB(i).c());
                double num3 = this.MethodB(i).d();
                double num4 = num3 / (num3 + num);
                at.d(num4);
                x.X += at.a;
                x.Y += at.b;
                num += num3;
            }
            return x;
        }

        public void MethodB(ClassAl A_0)
        {
            base.PolygonHoles.Add(A_0);
        }

        public ClassAl MethodB(int A_0)
        {
            return (base.PolygonHoles[A_0] as ClassAl);
        }

        public void MethodB(ClassD A_0, List<ClassD> A_1, ClassAg A_2)
        {
            List<PolygonalShape> list = new List<PolygonalShape>();
            base.MethodB1(A_0, list, A_2);
            for (int i = 0; i < list.Count; i++)
            {
                A_1.Add(new ClassD(list[i]));
            }
        }

        public double c()
        {
            double num = 0.0;
            num += this.MethodA().d();
            for (int i = 0; i < base.PolygonHoles.Count; i++)
            {
                num -= this.MethodB(i).d();
            }
            return num;
        }

        public void c(ClassD A_0, List<ClassD> A_1, ClassAg A_2)
        {
            List<PolygonalShape> list = new List<PolygonalShape>();
            base.c(A_0, list, A_2);
            for (int i = 0; i < list.Count; i++)
            {
                A_1.Add(new ClassD(list[i]));
            }
        }
    }
}

